<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" src="jquery.js"></script>
<script language="javascript" type="text/javascript" >
 $(document).ready(function() {
   // use this to reset a single form
   $("#reset").click(function() {
    $(':input','#form') 
    .not(':button, :submit, :reset, :hidden') 
    .val('') 
    .removeAttr('checked') 
    .removeAttr('selected');
   });
 });
 //this smart way and easy but code not work
//$(document).ready(function() { 
//    $("#btnAdd").click(function() {
//      var element_html=$("#target_table tr:last").html();
//      $("#target_table").append(element_html);
//
// });
// });
//
var destTable = $("#numbers"); 
$(document).ready(function() {  
$("#btnAdd").click(function() {   
    //the next variable contain the last empty row  center
 var newRow = $("<tr> <td><div align=center ><input type=text  ></div></td><td><div align=center ><input type=text ></div></td><td><div align=center> <input type=text> </div></td><td><div align=center> <input type=text > </div></td><td><div align=>  <textarea wrap=soft cols=25 rows=4 > </textarea></div></td> <td><div align=center> <input type=checkbox   value=Yes>Yes </td> <td><div align=center><a href=Delete_table.php>Delete</div></td>  </tr>");    
 $("#target_table").append(newRow);  
 }); 
});

</script>

<style type="text/css">
<!--
.style1 {font-size: 36px}
body {
	background-color: #C8E0E1;
}
-->
</style>
</head>
<body>
<div align="center" class="style1">EDIT TABLE </div>
<p></p>
  <form name="form" method="post" action="insert_table.php">
<table width="100%" border="0"  align="center" bgcolor="#3366FF">
  <tr align="center">
    <th scope="col">Name</th>
    <th scope="col">Source</th>
    <th scope="col">PhysicalName</th>
    <th scope="col"><p>Contents</p>    </th>
    <th scope="col">Length</th>
    <th scope="col">Description</th>
  </tr>
  <tr align="center">
    <td ><input type="text" align="middle" name="t[]" value="<?PHP $t_array=$_POST["t"]; echo $t_array[0]; ?>" ></td>
    <td ><input align="middle" type="text" name="t[]" value="<?PHP $t_array=$_POST["t"]; echo $t_array[1]; ?>"></td>
    <td ><input align="middle" type="text" name="t[]" value="<?PHP $t_array=$_POST["t"]; echo $t_array[2]; ?>"></td>
    <td ><input align='middle' type="text" name="t[]" value="<?PHP $t_array=$_POST["t"]; echo $t_array[3]; ?>"></td>
    <td ><input  align="middle" type="text" name="t[]" value="<?PHP $t_array=$_POST["t"]; echo $t_array[4]; ?>"></td>
    <td ><input  align="middle" type="text" name="t[]" value="<?PHP $t_array=$_POST["t"]; echo $t_array[5]; ?>">
	     <input type="hidden" name="Rec_insert_update" value="insert_table">
	</td>
  
  </tr>
</table>
<p align="center" class="style1">FIELDS</p>
<table width="100%"  border="1" id="target_table">
  <tr>
    <th width="16%" scope="col"><div align="center"><font style="font-size:11px" color="#000000" face="Arial">Name</font></div></th>
    <th width="19%" scope="col"><div align="center"><font style="font-size:11px" color="#000000" face="Arial">Position</font></div></th>
    <th width="17%" scope="col"><div align="center"><font style="font-size:11px" color="#000000" face="Arial">Lenght</font></div></th>
    <th width="17%" scope="col"><div align="center"><font style="font-size:11px" color="#000000" face="Arial">Type</font></div></th>
    <th width="14%" scope="col"><div align="center"><font style="font-size:11px" color="#000000" face="Arial">Description</font></div></th>
    <th width="11%" scope="col"><div align="center"><font style="font-size:11px" color="#000000" face="Arial">Primary</font></div></th>
    <th width="6%" scope="col"><div align="center"></div></th>
  </tr>
  <tr>
    <td><div align="center">
      <input type="text" width="140" name="Field_Name[9999]">
    </div></td>
    <td><div align="center">
      <input type="text" name="Field_Position[9999]">
    </div></td>
    <td><div align="center">
      <input type="text" name="Field_Length[9999]">
    </div></td>
    <td><div align="center">
      <input type="text" name="Field_Type[9999]">
    </div></td>
    <td><div align="center">
	<textarea name="Field_Description[9999]" wrap=soft cols=25 rows=4></textarea>
    </div></td>
    <td><div align="center">
      <input type="checkbox"  name="Field_primary[9999]" value="Yes">Yes 
	  </td>
    <td><div align="center"><a href=Delete_table.php?t_id=-1&f_id=9999>Delete</a></div></td>
  </tr>
</table>

<table width="100%"  border="0">
    <tr>
      <th width="54%" scope="col"><a href="index.php">Cancel</a></th>
      <th width="46%" scope="col"><button  id="reset">RESET</button></th>
      <th width="46%" scope="col"><button id="btnAdd">ADD NEW FIELD</button></th>
    </tr>
    <tr>
        <td colspan="3" align="center"><input type="submit" value="Commit"></td>
    </tr>
  </table>
</form>
<p align="center" class="style1">&nbsp;</p>
</body>
</html>
